﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using InformaticaDiaryWeb.Models;
using InformaticaDiaryWeb.Service;

namespace InformaticaDiaryWeb.Controllers
{
    public class SearchController : Controller
    {
        //
        // GET: /MyPages/
        [HttpGet]
        public ActionResult Dashboard()
        {
            return View();
        }
        [HttpGet]
        public ActionResult SearchCaseNo()
        {
            SearchCaseNoModel objmodel = new SearchCaseNoModel();
            DataAccess objDataAccess = new DataAccess();
            objmodel.listCaseType = objDataAccess.GetCaseType().Select(i => new SelectListItem()
            {
                Text = i.CaseTypeName.ToString(),
                Value = i.CaseTypeID.ToString()
            });
            objmodel.listCaseYear = objDataAccess.GetYear().Select(i => new SelectListItem()
            {
                Text = i.ToString(),
                Value = i.ToString()
            });
            return View(objmodel);
        }

        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult SearchCaseNo(SearchCaseNoModel model)
        {
            if (ModelState.IsValid)
            {

            }
            Session["searchreq"] = model;
            return RedirectToAction("ResultCaseNo", "Result");
        }

        [HttpGet]
        public ActionResult SearchJudgement()
        {
            SearchJudgementModel objmodel = new SearchJudgementModel();
            return View(objmodel);
        }
        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult SearchJudgement(SearchJudgementModel model)
        {
            if (ModelState.IsValid)
            {


            }
            Session["searchreq"] = model;
            return RedirectToAction("ResultJudgement", "Result");

        }

        [HttpGet]
        public ActionResult SearchPetitioner()
        {
            SearchPetitionerModel objmodel = new SearchPetitionerModel();
            DataAccess objDataAccess = new DataAccess();
            objmodel.listCaseYear = objDataAccess.GetYear().Select(i => new SelectListItem()
            {
                Text = i.ToString(),
                Value = i.ToString()
            });

            return View(objmodel);
        }

        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult SearchPetitioner(SearchPetitionerModel model)
        {
            if (ModelState.IsValid)
            {


            }
            Session["searchreq"] = model;
            return RedirectToAction("ResultPetitioner", "Result");

        }

        [HttpGet]
        public ActionResult SearchRespondant()
        {

            DataAccess objDataAccess = new DataAccess();

            SearchRespondantModel objmodel = new SearchRespondantModel();
            objmodel.listCaseYear = objDataAccess.GetYear().Select(i => new SelectListItem()
            {
                Text = i.ToString(),
                Value = i.ToString()
            });
            return View(objmodel);
        }
        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult SearchRespondant(SearchRespondantModel model)
        {
            if (ModelState.IsValid)
            {


            }
            Session["searchreq"] = model;
            return RedirectToAction("ResultRespondant", "Result");

        }
    }
}
